#ifndef TCPCLIENT_H
#define TCPCLIENT_H


#include <QtNetwork\QTcpSocket>
#include <QtNetwork\QHostAddress>
#include <QTimer>
#include <QDateTime>


class TcpClientThread : public QObject
{
    Q_OBJECT
public:
    TcpClientThread(QObject* parent = NULL);
    ~TcpClientThread();

	void initData();
	QString GetCorrectUnicode(const QByteArray &ba);
	void startConnect();


signals:
	void signalSendMsgToOtherProcess(int orderType, QList<QByteArray> msgList);

	private slots:
	void slotEnter();
	void slotConnected();
	void slotDisconnected();
	void slotDataReceivedFromServer();
	void SlotHeartBeat();
	void SlotReconnect();
	
	public slots:
	void slotReceiveMsgFromOtherProcess(int orderType, QList<QByteArray> msgList);


private:
    QHostAddress* m_serverIP;
    QTcpSocket* m_tcpSocket;
    QDateTime m_receivedTime;
    QDateTime m_checkTime;
    QTimer *m_checkStatusTimer;

	QTimer *m_reconnectTimer;
	QDateTime m_updateTime;

	bool m_isConnected;

};


#endif